<?php echo validation_errors("<div class='alert alert-danger'>", "</div>"); ?>
<form class="form-horizontal" method="post" enctype="multipart/form-data">
    
    <div class="form-group">
        <label class="col-lg-2 control-label">NC</label>
        <div class="col-lg-4"><?=$nc['idnc']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Fecha</label>
        <div class="col-lg-4"><?=substr($nc['fecha'],8,2).'/'.substr($nc['fecha'], 5, 2).'/'.substr($nc['fecha'], 0, 4)?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Detect&oacute;</label>
        <div class="col-lg-4"><?=$nc['detecto']['nombre'].' '.$nc['detecto']['apellido']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">NC derivada a</label>
        <div class="col-lg-4"><?=$nc['derivar']['nombre'].' '.$nc['derivar']['apellido']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Sector afectado</label>
        <div class="col-lg-4"><?=$nc['sector']['sector']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Proceso afectado</label>
        <div class="col-lg-4"><?=$nc['proceso']['proceso']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">NC de</label>
        <div class="col-lg-4"><?=$nc['nc_de']['nc_de']?></div>
    </div>
    <?php
    if ($nc['nc_de']['nc_de'] == 'Producto') {
    ?>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Cantidad</label>
        <div class="col-lg-4"><?=$nc['cantidad']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Insumo</label>
        <div class="col-lg-4"><?=$nc['insumo']['insumo']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Proveedor</label>
        <div class="col-lg-4"><?=$nc['proveedor']['proveedor']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Remito</label>
        <div class="col-lg-4"><?=$nc['remito']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Lote</label>
        <div class="col-lg-4"><?=$nc['lote']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">IRM</label>
        <div class="col-lg-4"><?=$nc['IRM']?></div>
    </div>
    
    <?php } ?>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Tipo</label>
        <div class="col-lg-4"><?=$nc['tipo']['tipo_nc']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Descripci&oacute;n</label>
        <div class="col-lg-4"><?=$nc['descripcion']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Imagen</label>
        <div class="col-lg-10">
            <?php if($nc['imagen'] != '') { ?>
                <img src="/upload/<?=$nc['imagen']?>">
            <?php } else { 
                echo "No tiene imagen"; 
                  } ?>
        </div>
    </div>
    
    <hr>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Disposici&oacute;n</label>
        <div class="col-lg-4"><?=$nc['derivada']['disposicion']['disposicion']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Descripci&oacute;n</label>
        <div class="col-lg-4"><?=$nc['derivada']['descripcion']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Tipo</label>
        <div class="col-lg-4"><?=$nc['derivada']['accion']['tipo_accion']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Fecha Prevista</label>
        <div class="col-lg-4"><?=substr($nc['derivada']['fecha_prevista'], 8, 2).'/'.substr($nc['derivada']['fecha_prevista'], 5, 2).'/'.substr($nc['derivada']['fecha_prevista'], 0, 4)?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">An&aacute;lisis de Causa Ra&iacute;z</label>
        <div class="col-lg-4"><?=$nc['derivada']['causa_raiz']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Acci&oacute;n</label>
        <div class="col-lg-4"><?=$nc['derivada']['accion_text']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Aprueba</label>
        <div class="col-lg-4"><?=$nc['derivada']['aprueba']['nombre'].' '.$nc['derivada']['aprueba']['apellido']?></div>
    </div>
    
    <hr>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Aprobada</label>
        <div class="col-lg-4"><?=($nc['aprobacion']['aprobada']==1)?"Si":"No"?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Comentarios</label>
        <div class="col-lg-4"><?=$nc['aprobacion']['comentarios']?></div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Comentarios</label>
        <div class="col-lg-4"><?=$nc['aprobacion']['ejecutor']['nombre'].' '.$nc['aprobacion']['ejecutor']['apellido']?></div>
    </div>

    <hr>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Fecha</label>
        <div class="col-lg-2">
            <div id="datepicker" class="input-append">
                <input id="fecha" name="fecha" data-format="yyyy-MM-dd" type="text" value="<?php echo set_value('fecha'); ?>">
                <span class="add-on">
                    <span data-time-icon="icon-time" data-date-icon="icon-calendar" class="glyphicon glyphicon-calendar" readonly="readonly"></span>
                </span>
            </div>
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label">Descripci&oacute;n</label>
        <div class="col-lg-4">
            <textarea name="descripcion" class="form-control"><?=set_value('descripcion')?></textarea>
        </div>
    </div>
    
    <div class="form-group">
        <label class=" col-lg-2 control-label" for="detecto">Verific&oacute;</label>
        <div class="col-lg-4" >
            <select name="verifico" class="form-control chosen">
            <? foreach ($usuarios as $usuario) { ?>  
                <option value="<?= $usuario['idusuario']?>"><?=$usuario['nombre'].' '.$usuario['apellido']?></option> 
            <? } ?>
            </select>
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-lg-2 control-label"></label>
        <div class="col-lg-4">
            <button type="submit" class="btn btn-primary">Crear</button>
        </div>
    </div>

    </div>
</form>

<script type="text/javascript">
    $(document).ready(function() {
        $(".chosen").chosen();
    });
    $('#datepicker').datetimepicker({
        pickTime: false
    });
</script>